package com.stylefeng.guns.modular.scheduler;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.stylefeng.guns.common.persistence.dao.PfFileMapper;
import com.stylefeng.guns.common.persistence.model.PfFile;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

/**
 * 定时任务
 */
@Configuration
@EnableScheduling
public class MyScheduler {
    private final Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private PfFileMapper pfFileMapper;

    /**
     * 文件清理
     */
//    @Scheduled(cron = "0 0 0/24 * * ?") // 每24小时执行一次
//    public void getAccessToken() {
//        logger.debug("清理待使用图片!");
//        int r = pfFileMapper.delete(new EntityWrapper<PfFile>().eq("status",1));
//    }

//    @Scheduled(cron = "0 0 0/1 * * ?") // 每1小时执行一次
//    @CacheEvict(cacheNames = "wxuserAmount",allEntries=true)
//    public void getToken() throws Exception{
//        logger.info("红包过期定时任务启动");
//    }
}
